package com.mk.common.util;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class XMLDemo {
	@Test
	public void test1() throws Exception {
		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
		DocumentBuilder db = factory.newDocumentBuilder();
		
		Document doc = db.parse("D:/repository/webPage/XML/as.xml");
		NodeList list  = doc.getElementsByTagName("p");
		
		Node node = list.item(0);
		System.out.println(node.getTextContent());
	}

}
